layui.config({
    base: '/plugins/module/'
});
layui.use(['jquery', 'form', 'table', 'layer'], function () {
    var $ = layui.jquery;
    var form = layui.form;
    var table = layui.table;
    //加载 数据
    var tableIns;
    tableIns = table.render({
        elem: ' #tab_showReward '
        , url: '/reward/showReward1'
        , toolbar: '#title-cust-ui' //开启头部工具栏，并为其绑定左侧模板
        , title: '得奖人表'
        , height: 'full-280'
        , limit: 50
        , page: true
        , cols: [[
            {field: 'id', sort: true, title: '标识编码', align: 'center'}
            , {field: 'name', title: '名字', align: 'center'}
            , {field: 'development', title: '部门', align: 'center'}
            , {field: 'major', title: '专业', align: 'center'}
            , {field: 'classes', title: '班级', align: 'center'}
            , {field: 'rwd_state', title: '获取级别', align: 'center'}
        ]]
        , done: function (res, curr, count) { //处理删除某一页最后一条数据的BUG
            if (res.data.length == 0 && curr != 1) {
                tableIns.reload({
                    page: {
                        curr: (curr - 1)
                    }
                });
            }
        }
    });
    //模糊查询
    form.on("submit(doSearch)", function (data) {
        tableIns.reload({
            where: data.field,
            page: {
                curr: 1
            }
        });
        return false;
    });

});
